package leetcode.day_2020_2021_2_1_2021_2_7;

/**
 * 27. 移除元素
 * https://leetcode-cn.com/problems/remove-element/
 */
public class LeetCode0027 {

    public int removeElement(int[] nums, int val) {
        int index = 0;
        for (int i=0; i<nums.length; i++) {
            if (nums[i] != val) {
                nums[index] = nums[i];
                index++;
            }
        }
        return index;
    }
}
